<template>
  <div class="container">
    <el-carousel :interval="5000" arrow="always" height="456px">
      <el-carousel-item v-for="item in bannerInfo" :key="item.carouselid">
        <img :src="item.url" alt="" />
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>
import { getHomeBanner } from "../api/home";

export default {
  name: "CarouselBanner",

  data() {
    return {
      bannerInfo: "",
    };
  },

  created() {
    this.init();
  },
  mounted() {},

  methods: {
    init() {
      getHomeBanner()
        .then((res) => {
          this.bannerInfo = res.data;
        })
        .catch((err) => {
          console.log(err);
        });
    },
  },
};
</script>

<style lang="scss" scoped>
img {
  width: 100%;
  height: 100%;
}
.container {
  width: 1200px;
  height: 456px;
  margin: 23px auto 35px;
}
</style>
